package com.buddies.lottery.ui.lottery.trend;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.resp.LotteryTrendResponse;

import java.util.Map;

public class LotteryTrendPresenter extends BasePresenter<LotteryTrendContract.View> implements LotteryTrendContract.Presenter {

    public LotteryTrendPresenter(LotteryTrendContract.View view) {
        super(view);
    }

    @Override
    public void onLoadData(Map<String, Object> params, int page) {
        addSubscription(DataManager.getInstance().getLotteryRepo().getLotteryTrend(params, page), new BaseObserver<LotteryTrendResponse>() {
            @Override
            public void onNext(LotteryTrendResponse response) {
                mView.onDataLoaded(response);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        });
    }

}
